<!DOCTYPE html>
<html lang="en">

<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>Document</title>
</head>

<body>
	<div class="main">
		<div class="box">你好</div>
	</div>


	<!--<div class="box">
		<div class="left">左边</div>
		<div class="right">右边</div>
	</div>-->

	<!--<div class="wrap">
		<div class="left">左侧</div>
		<div class="right">右侧</div>
		<div class="middle">中间</div>
	</div>-->


	<!--<div class="container">
		<div class="left">左边固定宽度</div>
		<div class="right">右边固定宽度</div>
		<div class="main">中间自适应</div>
	</div>-->

	<!--<div class="main-wrapper">
		<div class="main">中间自适应</div>
	</div>
	<div class="left">左边固定宽度</div>
	<div class="right">右边固定宽度</div>-->

</body>

</html>
<style>
	* {
		margin: 0;
		padding: 0;
	}
	/* 三栏布局 */
	 /*生成BFC，计算高度时考虑浮动的元素*/
 /*.wrap {
        background: #eee;
        overflow: hidden;
        padding: 20px;
        height: 200px;
    }
    .left {
        width: 200px;
        height: 200px;
        float: left;
        background: coral;
    }
    .right {
        width: 120px;
        height: 200px;
        float: right;
        background: lightblue;
    }
    .middle {
        margin-left: 220px;
        height: 200px;
        background: lightpink;
        margin-right: 140px;
    }*/
/*
	.container {
    position: relative;
  }

  .left,
  .right,
  .main {
    height: 200px;
    line-height: 200px;
    text-align: center;
  }

  .left {
    position: absolute;
    top: 0;
    left: 0;
    width: 100px;
    background: green;
  }

  .right {
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    background: green;
  }

  .main {
    margin: 0 110px;
    background: black;
    color: white;
  }*/

  /*.left,
	.right,
	.main {
	height: 200px;
	line-height: 200px;
	text-align: center;
	}

	.main-wrapper {
	float: left;
	width: 100%;
	}

	.main {
	margin: 0 110px;
	background: pink;
	color: white;
	}

	.left,
	.right {
	float: left;
	width: 100px;
	margin-left: -100%;
	background: green;
	}
	.right {
		margin-left: -100px;
	}*/


	/* 双栏布局 */
	 /*添加BFC*/
	 /*.box{
        overflow: hidden;
    }
    .left {
        float: left;
        width: 200px;
        background-color: gray;
        height: 400px;
    }
    .right {
        margin-left: 210px;
        background-color: lightgray;
        height: 200px;
    }*/


	/*.box{
        display: flex;
		align-items: stretch;
    }
    .left {
        width: 100px;
		background:orange;
    }
    .right {
        flex: 1;
		background:cornflowerblue;
		align-items: flex-start
    }*/

	/* 元素水平垂直居中 */

	/*定位1*/
	/*.main {
		width: 100vw;
		height: 100vh;
		background: orange;
		position: relative;
	}

	.box {
		width: 100px;
		height: 100px;
		background: skyblue;
		position: absolute;
		top: calc(50% - 50px);
		left: calc(50% - 50px);
	}*/
		/*定位2*/
	/*.main {
		width: 100vw;
		height: 100vh;
		background: purple;
		position: relative;
	}

	.box {
		width: 100px;
		height: 100px;
		background: skyblue;
		position: absolute;
		top:0;
		bottom:0;
		left:0;
		right:0;
		margin:auto;
	}*/
	/*定位3  transform*/
	/*.main {
		width: 100vw;
		height: 100vh;
		background: yellow;
		position: relative;
	}

	.box {
		width: 100px;
		height: 100px;
		background: skyblue;
		position: absolute;
		top: 50%;
		left: 50%;
		transform:translate(-50%,-50%);
	}*/
	/*flex*/
	/*.main {
		width: 100vw;
		height: 100vh;
		background: blue;
		display: flex;
		flex-direction: row;
		align-items: center;
		justify-content: center;
	}

	.box {
		width: 100px;
		height: 100px;
		background: orange;
	}*/
	/*grid栅格布局*/
	/*.main {
		width: 100vw;
		height: 100vh;
		background:skyblue;
		display: grid;
	}

	.box {
		width: 100px;
		height: 100px;
		background: pink;
		align-self:center;
		justify-self: center;
	}*/

/* table-cell实现文字内容水平垂直居中 , 设置好之后margin属性失效*/
	/*.main {
		width: 100vw;
		height: 100vh;
		background:purple;
		position: relative;
	}

	.box {
		width: 100px;
		height: 100px;
		background: orange;
		display: table-cell;
		vertical-align: middle;
		text-align: center;
		position: relative;
		top: 100px;
		left: 75px;
	}*/
</style>
